(function(angular) {
	'use strict';
	angular.module("fs.waf").factory("passwordPolicyService", passwordPolicyService);
	passwordPolicyService.$inject = [ '$q', 'loggerFactory', 'ajaxServiceFactory'];
	function passwordPolicyService($q, loggerFactory, ajaxServiceFactory) {
		var log = loggerFactory.getLogger("passwordPolicyService");
		var ajaxService = ajaxServiceFactory.buildAjaxService({
			getValidationDatas : {
				url : 'do/cda/passwordPolicy/validationDatas',
				method : 'post'
			}
		});
		
		function getValidationDatas(){
			var defer = $q.defer();
			ajaxService.getValidationDatas().then(function(response){
			    defer.resolve(response ? response.data : {});
			});
			return defer.promise;
		}

		function initDefault(){
			var defer = $q.defer();
			var object = {};
			object.enforcePolicyFlag='Y';
			object.lenFlag='Y';
			object.lenMin=1;
			object.lenMax=16;
			object.pwdHistoryLen=0;
			object.specialCharsNum=0;
			object.specialChars='~!@#$%^&*()-+_={}[]:;<>?,./1234567890';
			object.expiryDays=30;
			object.numLogonTry=3;
			object.autoUnlockPeriod=60;
			object.autoUnlockFlag='Y';
			object.mixCasesFlag='N';
			object.inactivitySiteuserFlag='N';
			defer.resolve(object);
			return defer.promise;
		}
		return {
			initDefault : initDefault,
			getValidationDatas : getValidationDatas
		};
	}
})(angular);